home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / smail-3.1.28 / src / spool.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-11  |  1.3 KB  |  47 lines

  1. /* @(#)src/spool.h    1.3 7/11/92 11:51:14 */
  2.  
  3. /*
  4.  *    Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll
  5.  *    Copyright (C) 1992  Ronald S. Karr
  6.  * 
  7.  * See the file COPYING, distributed with smail, for restriction
  8.  * and warranty information.
  9.  */
  10.  
  11. /*
  12.  * spool.h:
  13.  *    interface file for routines in spool.c
  14.  */
  15.  
  16. /* macros used in spool.c */
  17. #define READ_FAIL    -2        /* spool file read failed */
  18. #define WRITE_FAIL    -1        /* general-purpose write failed */
  19. /* size of spool file basename */
  20. #define SPOOL_FN_LEN    (sizeof("tttttt-iiiiiig") - 1)
  21.  
  22. /*
  23.  * GETSPOOL fetches characters from the spool buffer
  24.  * and calls read_spool to read more characters when the
  25.  * end of the buffer is reached.
  26.  * returns a char or EOF on end-of-file or READ_FAILED on read error
  27.  */
  28. #define GETSPOOL()    (msg_ptr<msg_max ?                \
  29.                  0xff&(*msg_ptr++) :            \
  30.                 (msg_foffset+(msg_max-msg_buf) >= msg_size ?\
  31.                     EOF :                    \
  32.                 read_spool() == FAIL ?            \
  33.                     READ_FAIL :                \
  34.                      0xff&(*msg_ptr++)))
  35.  
  36. /*
  37.  * PUTSPOOL(c) writes a character to the spool file buffer and
  38.  * flushes the buffer when it is full.
  39.  */
  40. #define PUTSPOOL(c)    (msg_max < end_msg_buf ?            \
  41.                 (0xff &(*msg_max++ = (c))) :        \
  42.                 write_spool() == FAIL ?            \
  43.                 EOF :                    \
  44.                 (msg_foffset += msg_max - msg_buf,    \
  45.                  msg_max = msg_buf,            \
  46.                  (0xff & (*msg_max++ = (c)))))
  47.